import Vue from 'vue'
import Vuex from 'vuex'

const state={
  cardNumber:0,
  isAuthorize:false,
  loginReady:false,//登陆成功
  globalAudioContext:null,
  globalAudioType:"play",
  initInfo:{},//初始化数据
  appInfo:{},//设置版本 和用户id
  myRank:{},//我的排行信息
  rankList:[],//超越我的好友列表
  IMGHEAD:"https://ggbsq.xingpanwang.com/renren-fast/lookGuessImage/",//图片地址前缀
  AUDIOHEAD:"https://ggbsq.xingpanwang.com/renren-fast/lookGuessAudio/",
  SESSIONID:"",//登凭证
  SCENE:0,//场景值
  userInfo:null,//用户信息
  deviceInfo:{},//设备信息,
  energy:0,//用户体力
  maxEnergy:300,//最大体力上限
  baseAddEngergy:1,//倒计时增加体力基数
  tipEnergy:5,//选项提示扣除体力基数
  tipWordEnergy:30,//选字提示扣除体力基数
  lockCard:-1,
  sysConfig:{
    baseTime:0,//体力恢复时间
    baseCard:0,//小关卡题目基数
    baseEnergy:10,//解锁需要花费的体力
    baseEnergyCost:1,//花费多少回满体力
    baseSkipCost:1,//花费多少跳关
    maxEnergy:300,//最大体力上限
    baseShareGetEnergy:1,//分享增加体力基数
  },//系统配置信息
}

const mutations={
  setCardNumber(state,info){
    state.cardNumber = info;
  },
  setInitInfo(state,info){
    state.initInfo = info;
  },
  setAuthorize(state,boolean){
    state.isAuthorize = boolean;
  },
  setLoginReady(state,boolean){
    state.loginReady = boolean;
  },
  setGlobalAudio(state,globalAudioContext){
    state.globalAudioContext = globalAudioContext;
  },
  setGlobalAudioType(state,globalAudioType){
    state.globalAudioType = globalAudioType;
  },
  setAppInfo(state,appInfo){
    state.appInfo = appInfo;
  },
  setCard(state,card){ //上次解锁关卡数
    state.lockCard = card;
  },
  // set userInfo
  setUserInfo(state,userInfo){
    state.userInfo = userInfo;
  },
  setSessionId(state,id){
    state.SESSIONID = id;
  },
  setDeviceInfo(state,info){
    state.deviceInfo = info;
  },
  setScene(state,scene){
    state.SCENE = scene;
  },
  setSysConfig(state,config){
    state.sysConfig = config;
  },
  setEnergy(state,energy){
    state.energy = energy;
  },
  setRankList(state,list){
    state.rankList = list;
  },
  setMyRank(state,info){
    state.myRank = info;
  }
}

Vue.use(Vuex)
const store = new Vuex.Store({
  state: state,
  mutations: mutations,
})

export default  store
